<!--
 * @Author: WangGuojian 1085844536@qq.com
 * @Date: 2024-07-03 17:06:28
 * @LastEditTime: 2024-07-03 17:58:27
 * @LastEditors: WangGuojian 1085844536@qq.com
 * @FilePath: \html\code\2_CSS\18_定位\02_CSS_绝对定位.html
 * @Description:
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <title>CSS_绝对定位</title>
    <style>
        .outer {
            width: 500px;
            background-color: skyblue;
            border: 1px solid black;
            padding: 20px;
            position: relative;
        }

        .box {
            width: 200px;
            height: 200px;
            font-size: 20px;
        }

        .box1 {
            background-color: #888;
        }

        .box2 {
            background-color: orange;
            position: absolute;
            top: 220px;
            left: 20px;
            /* right: 0;
            bottom: 0; */
        }

        .box3 {
            background-color: green;
        }

        .outer:hover .box2 {
            left: 220px;
        }
    </style>
</head>

<body>
    <div class="outer">
        <div class="box box1">1</div>
        <div class="box box2">2</div>
        <div class="box box3">3</div>
    </div>
</body>

</html>